﻿using System.Xml.Serialization;

namespace HamcoWcs.Models.MesMessages
{
    [XmlInclude(typeof(MachineControlStateChangedDto))]
    [XmlInclude(typeof(MachineStateChangedDto))]
    [XmlInclude(typeof(PortStateChangedDto))]
    [XmlInclude(typeof(MachineModeChangeRequestDto))]
    [XmlInclude(typeof(MachineModeChangeReplyDto))]
    [XmlInclude(typeof(ChangeMachinePalletTypeRequestDto))]
    [XmlInclude(typeof(PalletAndBoxAssignRequestDto))]
    [XmlInclude(typeof(PalletAndBoxAssignReplyDto))]
    [XmlInclude(typeof(ValidatePalletInputRequestDto))]
    [XmlInclude(typeof(ValidatePalletInputReplyDto))]
    [XmlInclude(typeof(ValidatePalletListRequestDto))]
    [XmlInclude(typeof(ValidatePalletListReplyDto))]
    [XmlInclude(typeof(PalletLocationChangedReportDto))]
    [XmlInclude(typeof(PortTransferStateChangedDto))]
    [XmlInclude(typeof(PalletRequestTransportJobRequestDto))]
    [XmlInclude(typeof(PalletRequestTransportJobReplyDto))]
    [XmlInclude(typeof(PalletTransportJobStartedDto))]
    [XmlInclude(typeof(PalletLocationChangedDto))]
    [XmlInclude(typeof(PalletTransportJobCompletedDto))]
    [XmlInclude(typeof(AreYouThereRequestDto))]
    [XmlInclude(typeof(AreYouThereReplyDto))]
    [XmlInclude(typeof(InventoryPalletDataReportDto))]
    [XmlInclude(typeof(InventoryZoneDataReportDto))]




    public abstract class BaseMesBody
    {
        public BaseMesBody(string user = "", string comment = "")
        {

        }
        [XmlElement("EVENTUSER")]
        public string EventUser { get; set; }
        [XmlElement("EVENTCOMMENT")]
        public string EventComment { get; set; }
    }

    public abstract class MachineMesBody : BaseMesBody
    {
        public MachineMesBody(string machineName = "", string user = "", string comment = "") : base(user, comment)
        {
            this.MachineName = machineName;
        }
        [XmlElement("MACHINENAME")]
        public string MachineName { get; set; }
    }


    public abstract class PortMesBody : MachineMesBody
    {
        public PortMesBody(string machineName = "", string portName = "", string user = "", string comment = "") : base(machineName, user, comment)
        {
            this.PortName = portName;
        }
        [XmlElement("PORTNAME")]
        public string PortName { get; set; }
    }


    public abstract class PalletMesBody : PortMesBody
    {
        public PalletMesBody(string machineName = "", string portName = "", string palletName = "", string user = "", string comment = "")
            : base(machineName, portName, user, comment)
        {
            this.PalletName = palletName;
        }
        [XmlElement("PALLETNAME")]
        public string PalletName { get; set; }
    }

    public abstract class JobMesBody : BaseMesBody
    {
        public JobMesBody(string jobName = "", string user = "", string comment = "") : base(user, comment)
        {
            TransportJobName = jobName;
        }

        [XmlElement("TRANSPORTJOBNAME")]
        public string TransportJobName { get; set; }
    }
}
